﻿using System;
using System.Windows.Forms;

namespace AdvancedScriptEditor
{
    public partial class OptionsDialog : Form
    {
        Options options;
        string appPath;

        public OptionsDialog(Options prevoptions)
        {
            InitializeComponent();
            options = prevoptions;
            appPath = Properties.Settings.Default.AppPath;
        }

        private void OptionsDialog_Load(object sender, EventArgs e)
        {
            radiobtn_True.Checked = options.AutomaticallyShowAutocomplete;
            radiobtn_False.Checked = !options.AutomaticallyShowAutocomplete;
        }

        private void btn_Accept_Click(object sender, EventArgs e)
        {
            options.AutomaticallyShowAutocomplete = radiobtn_True.Checked;
            options.Save(appPath + "\\options.ini");
            MessageBox.Show("Changes saved.");
            this.Close();
        }

        private void btn_Cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
